package com.example.service;

import com.example.mapper.TBitMapper;
import com.example.model.TBit;
import com.example.server.annotation.HaeTransaction;
import com.example.server.util.HttpClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Auther: yuanjianpeng
 * @Date: 2019/4/18 01:06
 * @Description:
 */
@Service
public class TBitServiceImpl {

    @Autowired
    private TBitMapper tBitMapper;

    public List<String> search(String word){
        return tBitMapper.search(word);
    }

    public List<TBit> searchAll() {
        return tBitMapper.searchsearchAll();
    }

    @HaeTransaction(isStart = true)
    @Transactional
    public int insert(TBit tBit) {
        tBitMapper.insert(tBit);
        HttpClient.get("http://localhost:8282/server2/test");
        System.out.println(100/0);
        return 10;
    }
}
